package com.ordos.recruit.module.batch.controller;

import com.ordos.recruit.aop.anno.UnInternetApi;
import com.ordos.recruit.module.batch.entity.RecruitBatchApplyDto;
import com.ordos.recruit.module.batch.entity.RecruitBatchApplyPo;
import com.ordos.recruit.module.batch.service.RecruitBatchApplyService;
import com.wonders.commons.util.response.ApiResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 招聘申报批次Controller
 *
 * @author jin
 */
@RestController
@RequestMapping("batchApply")
public class RecruitBatchApplyController {

    private final RecruitBatchApplyService recruitBatchApplyService;

    public RecruitBatchApplyController(RecruitBatchApplyService recruitBatchApplyService) {
        this.recruitBatchApplyService = recruitBatchApplyService;
    }

    /**
     * 保存或修改申报数据接口。
     *
     * @return ApiResponse
     */
    @PostMapping("saveOrUpdate")
    @UnInternetApi
    public ApiResponse saveOrUpdate(@RequestBody RecruitBatchApplyDto recruitBatchApplyDto) {
        return recruitBatchApplyService.saveOrUpdate(recruitBatchApplyDto);
    }

    @PostMapping("view")
    @UnInternetApi
    public ApiResponse<RecruitBatchApplyPo> view(@RequestBody RecruitBatchApplyDto recruitBatchApplyDto) {
        return ApiResponse.success(recruitBatchApplyService.view(recruitBatchApplyDto));
    }

    @PostMapping("getNewstBatch")
    public ApiResponse<List<RecruitBatchApplyPo>> getList(@RequestBody RecruitBatchApplyDto recruitBatchApplyDto) {
        return ApiResponse.success(recruitBatchApplyService.getList(recruitBatchApplyDto));
    }

}
